package com.lt73.dynamicdatasource.service;

import com.lt73.dynamicdatasource.entity.Article;
import com.lt73.dynamicdatasource.repository.ArticleRepository;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author: hanxiao
 * @Date: 2022/4/15 11:45
 */
@Service
public class ArticleService {

    @Resource
    private ArticleRepository articleRepository;

    public List<Article> list() {
        return articleRepository.lambdaQueryPlus().list();
    }

    public Boolean insert(Article article) {
        return articleRepository.save(article);
    }

    public Boolean update(Article article) {
        return articleRepository.updateById(article);
    }
}
